<?php
include_once("locale/langmeta.php");

if(isset($_POST["lang"]))
{
	if($_POST["lang"] == "change"){
		if($_SESSION["LC_ALL"] == "vi")
			$_SESSION["LC_ALL"] = "en";	
		else
			$_SESSION["LC_ALL"] = "vi"	;
	}
}
if(isset($_SESSION["LC_ALL"]))
{
	$locale = $_SESSION["LC_ALL"];
	$country = $_SESSION["LC_COUNTRY"];
}
else
{
	$locale = DEFAULT_LANG;
}

if (isset($_POST["locale"])) 
{
	$locale = $_POST["locale"];
	$country = $_POST["txtcountry"];
}

$_SESSION["LC_ALL"] = $locale;
$_SESSION["LC_COUNTRY"] = $country;

if(!isset($langmeta[$locale]) &&
   !isset($langmeta[DEFAULT_LANG]))
{
	echo "Language not found. Please ask admistrator for more information.";
	die;
}
?>

